package com.hnust.controller;

import com.hnust.service.AddAnnotationService;
import com.hnust.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class AddAnnotationController {
    @Autowired
    private AddAnnotationService addAnnotationService;

    @PostMapping("check/addAnnotation")
    public Result<Object> addAnnotation(@RequestParam("stuId") String stuId,
                                        @RequestParam("testId") String testId,
                                        @RequestParam("queId") String queId,
                                        @RequestParam("annoMsg") String annoMsg){
        int i=addAnnotationService.addAnnotation(stuId,testId,queId,annoMsg);
        if(i!=0){
            System.out.println("成功");
            return new Result<Object>(200,"添加批注成功",null);
        }
        else{
            System.out.println("失败");
            return new Result<Object>(500,"添加批注失败",null);
        }
    }

}
